package cn.tedu.controller;

import cn.tedu.mapper.UserMapper;
import cn.tedu.pojo.Vo.UserVo1;
import cn.tedu.pojo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Justin Parker
 * @author 2024/8/8 下午11:25
 * @version 1.0
 */
@RestController
@RequestMapping("/v1/user")
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("insertUser")
    public String insertUser(User user) {
        userMapper.insertUser(user);
        return "添加成功";
    }

    @RequestMapping("selectListUser")
    public List<UserVo1> selectListUser() {
        return userMapper.selectListUser();
    }

    @RequestMapping("deleteUser")
    public String deleteUser(Integer id) {
        userMapper.deleteUser(id);
        return "删除成功";
    }

    @RequestMapping("updateUser")
    public String updateUser(User user) {
        userMapper.updateUser(user);
        return "修改成功";
    }
}
